package com.example.minispringtransation.service.impl;

import com.example.minispringtransation.annotation.MyTransaction;
import com.example.minispringtransation.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Auther: 郭敬仰
 * @Date: 2019/6/11 12:08
 * @Description:
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private JdbcTemplate jdbcTemplate;

//    @MyTransaction
    @Override
    public void insert() {
        jdbcTemplate.execute("INSERT INTO `test`.`user` (`id`, `username`, `password`, `name`) VALUES ('2', '用户名', '密码', 'xxx'); ");
        int i=1/0;
        jdbcTemplate.execute(" INSERT INTO `test`.`dept` (`id`, `dname`, `total`) VALUES ('1', '1', '1');");
    }
}
